package com.tcr.core;

import java.util.ArrayDeque;
import java.util.Queue;

import com.tcr.common.ZipTask;

public class ZipQueue {

	private ZipQueue() {
		t_queue = new ArrayDeque<ZipTask>();
	}

	public final synchronized static ZipQueue getInstance() {
		if (queue == null)
			queue = new ZipQueue();
		return queue;
	}

	public int size() {
		synchronized (t_queue) {
			return t_queue.size();
		}
	}

	public void putTask(ZipTask e) {
		synchronized (t_queue) {
			t_queue.offer(e);
		}
	}

	public ZipTask getTask() {
		synchronized (t_queue) {
			return t_queue.poll();
		}
	}

	private static ZipQueue queue;
	private Queue<ZipTask> t_queue;

}
